package com.yenlien.traceyun.usercenter.bean;

import com.yenlien.traceyun.usercenter.entity.CustomApp;
import com.yenlien.traceyun.usercenter.entity.CustomAppVersion;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: bigwangy@sina.com
 * @create: 2021-02-19
 * @description:
 **/
public class CustomAppView {

    private String id;

    private String name;

    private String iconImg;

    private String appId;

    private List<CustomAppVersion> versions = new ArrayList<>();

    public static CustomAppView create(CustomApp customApp) {
        CustomAppView view = new CustomAppView();
        view.setName(customApp.getName());
        view.setAppId(customApp.getAppId());
        view.setIconImg(customApp.getIconImg());
        view.setId(customApp.getId());
        return view;
    }

    public static List<CustomAppView> create(List<CustomApp> customApps) {
        List<CustomAppView> views = new ArrayList<>();
        if (customApps != null && customApps.size() > 0) {
            for (CustomApp customApp : customApps) {
                views.add(create(customApp));
            }
        }
        return views;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIconImg() {
        return iconImg;
    }

    public void setIconImg(String iconImg) {
        this.iconImg = iconImg;
    }

    public List<CustomAppVersion> getVersions() {
        return versions;
    }

    public void setVersions(List<CustomAppVersion> versions) {
        this.versions = versions;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }
}
